<template>
	<view class="chat">
		<view class="header">
			<view class="title">聊天</view>
			<view class="oper">
				<view class="item">
					<image src="@/static/images/19.png"></image>
				</view>
				<view class="item" @click="router('/pages/chat/search')">
					<image src="@/static/images/20.png"></image>
				</view>
			</view>
		</view>
		<scroll-view scroll-y class="scroll_view">
			<view class="list">
				<view class="item" v-for="item in 9" @click="router('/pages/chat/msg')">
					<image src="@/static/test/1.jpg" class="avatar"></image>
					<view class="item_view">
						<view class="name">范闲</view>
						<view class="item_text">分享[视频]·昨天 19:32</view>
					</view>
					<view class="unread">
						<view>99</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script setup>
	import useBase from "@/hooks/useBase.js";
	const {
		router
	} = useBase();
</script>

<style scoped lang="scss">
	.chat {
		height: calc(100vh - var(--window-top) - var(--window-bottom));
		overflow: hidden;

		.header {
			height: $navBarHeight;
			padding: 0 30rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.title {
				color: #FFFFFF;
				font-size: 36rpx;
				font-weight: bold;
			}

			.oper {
				display: flex;

				.item {
					margin-left: 50rpx;

					&:first-child {
						margin-left: 0;
					}

					image {
						width: 50rpx;
						height: 50rpx;
					}
				}
			}
		}

		.scroll_view {
			height: calc(100vh - #{$navBarHeight} - var(--window-top) - var(--window-bottom));

			.list {
				padding: 50rpx 40rpx 0;
				box-sizing: border-box;

				.item {
					margin-bottom: 36rpx;
					display: flex;

					.avatar {
						width: 118rpx;
						height: 118rpx;
						border-radius: 50%;
					}

					.item_view {
						flex: 1;
						padding: 20rpx 30rpx;
						box-sizing: border-box;
						display: flex;
						flex-direction: column;
						justify-content: space-between;

						.name {
							color: #EEEEEE;
							font-size: 36rpx;
							font-weight: bold;
						}

						.item_text {
							color: #999999;
							font-size: 28rpx;
							font-weight: bold;
						}
					}

					.unread {
						display: flex;
						justify-content: center;
						align-items: center;

						view {
							width: 38rpx;
							height: 38rpx;
							line-height: 38rpx;
							text-align: center;
							color: #FFFFFF;
							font-size: 24rpx;
							font-weight: bold;
							border-radius: 50%;
							background: #FC2B55;
						}
					}
				}
			}
		}
	}
</style>